﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;

namespace WMI.NET.CIM
{
    /// <summary>
    /// The CIM_System class aggregates an enumerable set of managed system elements. The aggregation operates as a functional whole. Within any particular subclass of the system, there is a well-defined list of managed system element classes whose instances must be aggregated.
    /// The CIM_System object and its derivatives are top-level objects of CIM. They provide the scope for numerous components and are required to have unique system keys.
    /// </summary>
    public class CIM_System : CIM_LogicalElement
    {

        private string _CreationClassName;
        private string _NameFormat;
        private string _PrimaryOwnerContact;
        private string _PrimaryOwnerName;
        private string[] _Roles;

        /// <summary>
        /// Name of the class or subclass used in the creation of an instance. When used with other key properties of the class, this property allows all instances of the class and its subclasses to be uniquely identified.
        /// </summary>
        public string CreationClassName { get { return _CreationClassName; } }

        /// <summary>
        /// Identifies how the system name was generated, using the subclass heuristic.
        /// </summary>
        public string NameFormat { get { return _NameFormat; } }

        /// <summary>
        /// How the primary system owner can be reached (for example, phone number or email address).
        /// </summary>
        public string PrimaryOwnerContact { get { return _PrimaryOwnerContact; } }

        /// <summary>
        /// Name of the primary system owner.
        /// </summary>
        public string PrimaryOwnerName { get { return _PrimaryOwnerName; } }

        /// <summary>
        /// Roles the system plays in the information technology environment. Subclasses of the system can override this property to define explicit role values. Alternately, a working group can describe the heuristics, conventions, and guidelines for specifying roles. For example, for an instance of a networking system, this property might contain the string "Switch" or "Bridge".
        /// </summary>
        public string[] Roles { get { return _Roles; } set { throw new NotImplementedException(); } }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mbo"></param>
        public CIM_System(ManagementBaseObject mbo)
            : base(mbo)
        {
            _CreationClassName = mbo.GetStringValue("CreationClassName");
            _NameFormat = mbo.GetStringValue("NameFormat");
            _PrimaryOwnerContact = mbo.GetStringValue("PrimaryOwnerContact");
            _PrimaryOwnerName = mbo.GetStringValue("PrimaryOwnerName");
            _Roles = mbo.GetStringValueArray("Roles");
        }

    }
}
